package com.xxl.job.admin;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;

import java.net.InetAddress;
import java.net.UnknownHostException;

/**
 * xxlJob 管理后台启动类
 *
 * @author : zyc
 * @version : 1.0
 * @date : 2024/8/19 16:43
 */

@SpringBootApplication
public class XxlJobAdminApplication {

    public static void main(String[] args) throws UnknownHostException {
        ConfigurableApplicationContext application = SpringApplication.run(XxlJobAdminApplication.class, args);
        Environment env = application.getEnvironment();
        String ip = InetAddress.getLocalHost().getHostAddress();
        String port = env.getProperty("server.port");
        String contextPath = env.getProperty("server.servlet.context-path");
        System.out.println("\n---------------------------------------------------------\n\t" +
                "Application xxl-job-admin is running! Access URLs:\n\t" +
                "Local: \t\thttp://localhost:" + port + contextPath + "/\n\t" +
                "External: \thttp://" + ip + ":" + port + contextPath + "/\n\t");
        System.out.println("-----------------------------------------------------------");
    }

}